package com.atguigu.gulimall.product.feign;

import com.atguigu.common.to.SkuReductionTo;
import com.atguigu.common.to.SpuBoundsTo;
import com.atguigu.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;


@FeignClient("gulimall-coupon")
public interface CouponFeignService {

    /**
     * 远程调用的步骤
     *  1、由于有@RequestBody注解，会将SpuBoundsTo对象转为json格式
     *  2、在注册中心中找到gulimall-coupon服务，并发送http(s)请求，并把上一步的json作为请求体
     *  3、gulimall-coupon接到请求，将json转为入参对象并处理
     *  所以调用方和被调用方的参数不一定要完全一样，只要转成的json兼容（字段名一致）即可
     */
    @RequestMapping("/coupon/spubounds/save")
    public R save(@RequestBody SpuBoundsTo spuBounds);

    @RequestMapping("/coupon/skuladder/saveReductionInfo")
    public R saveReductionInfo(@RequestBody SkuReductionTo skuReductionTo);


}
